package org.perso.bd.application;

import org.perso.bd.resource.ListingResource;
import org.perso.bd.resource.ListingSQLResource;
import org.restlet.Restlet;
import org.restlet.resource.Directory;
import org.restlet.routing.Router;

/**
 * LECTRA
 * PerformanceMonitoringApplication class
 * @author c.maignien
 */
public class ListBDApplication extends org.restlet.Application {

    private String webAppCtxRoot;

    public ListBDApplication(String webAppCtxRoot) {
        setName("Application");
        this.webAppCtxRoot = webAppCtxRoot;
    }

    @Override
    public Restlet createInboundRoot() {
        Directory directory = new Directory(getContext(), "clap://class/static/");
        directory.setDeeplyAccessible(true);

        Router router = new Router(getContext());

        router.attach("/" + webAppCtxRoot, directory);
        router.attach("/listBD", ListingResource.class);
        router.attach("/listSQL",ListingSQLResource.class);
        return router;
    }
}
